package action.info;

import java.util.List;

import persistence.model.TdfkfaBulletin;
import presentation.PageVO;
import presentation.extendmodel.BulletinDetailModel;
import presentation.queryvo.BulletinQueryVO;
import service.BulletinService;

import com.googlecode.jsonplugin.annotations.JSON;
import com.opensymphony.xwork2.ActionSupport;

public class BulletinAction extends ActionSupport {

    private static final long serialVersionUID = -5295276973452637507L;

    private BulletinService bulletinService;

    private List<TdfkfaBulletin> bulletinList;

    private BulletinDetailModel bulletinDetail;

    private String bulletinId;

    private PageVO pageVO;

    private BulletinQueryVO queryVO;

    public String displayBulletinList() throws Exception {

        pageVO.setRecordNum(bulletinService.countBulletin(queryVO));
        bulletinList = bulletinService.getBulletinList(queryVO, pageVO.getIntPageIndex(), pageVO.getIntPageSize());
        return SUCCESS;
    }

    public String displayBulletinDetail() throws Exception {

        bulletinDetail = bulletinService.getBulletinDetail(new Integer(bulletinId));
        return SUCCESS;
    }

    @JSON(format = "yyyy-MM-dd HH:mm:ss")
    public List<TdfkfaBulletin> getBulletinList() {
        return bulletinList;
    }

    public void setBulletinId(String bulletinId) {
        this.bulletinId = bulletinId;
    }

    public BulletinDetailModel getBulletinDetail() {
        return bulletinDetail;
    }

    public BulletinQueryVO getQueryVO() {
        return queryVO;
    }

    public void setQueryVO(BulletinQueryVO queryVO) {
        this.queryVO = queryVO;
    }

    public PageVO getPageVO() {
        return pageVO;
    }

    public void setPageVO(PageVO pageVO) {
        this.pageVO = pageVO;
    }

    public void setBulletinService(BulletinService bulletinService) {
        this.bulletinService = bulletinService;
    }
}
